<!doctype html><html lang="zh-cn"
  >
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>云服务器上搭建solo博客 - Bootstrap</title><link rel="apple-touch-icon" href="/images/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="/images/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="/images/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="/images/favicons/manifest.json">
<link rel="icon" href="/images/favicons/favicon.ico">
<meta name="keywords" content="" />
<meta name="description" content="如何在服务器上搭建solo博客系统." /><meta itemprop="name" content="云服务器上搭建solo博客">
<meta itemprop="description" content="如何在服务器上搭建solo博客系统."><meta itemprop="datePublished" content="2021-10-02T00:00:00+00:00" />
<meta itemprop="dateModified" content="2021-10-02T00:00:00+00:00" />
<meta itemprop="wordCount" content="931"><meta itemprop="image" content="/images/markdown.png">
<meta itemprop="keywords" content="服务器,solo,博客," /><meta property="og:title" content="云服务器上搭建solo博客" />
<meta property="og:description" content="如何在服务器上搭建solo博客系统." />
<meta property="og:type" content="article" />
<meta property="og:url" content="/zh-cn/posts/%E9%98%BF%E9%87%8C%E4%BA%91ecs%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BAsolo%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F/" /><meta property="og:image" content="/images/markdown.png" /><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2021-10-02T00:00:00+00:00" />
<meta property="article:modified_time" content="2021-10-02T00:00:00+00:00" /><meta property="og:site_name" content="Bootstrap" />
<meta property="og:see_also" content="/zh-cn/posts/markdown-syntax/" />

<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="/images/markdown.png"/>

<meta name="twitter:title" content="云服务器上搭建solo博客"/>
<meta name="twitter:description" content="如何在服务器上搭建solo博客系统."/>
<meta name="twitter:site" content="@yourtwitterusername"/>
<link rel="preload" href="/css/bundle.min.fd4cecf242739163be984ae3de03d23c0bca36241435ac74374e102933e6797c.css" integrity="sha256-/Uzs8kJzkWO&#43;mErj3gPSPAvKNiQUNax0N04QKTPmeXw=" crossorigin="anonymous" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/css/bundle.min.fd4cecf242739163be984ae3de03d23c0bca36241435ac74374e102933e6797c.css" integrity="sha256-/Uzs8kJzkWO&#43;mErj3gPSPAvKNiQUNax0N04QKTPmeXw=" crossorigin="anonymous"></noscript><script src="/js/bundle.min.ba4b57bb653018b3da5a1e0ed23ac673e28c9f0624cc03f40d9c00568659899c.js" integrity="sha256-uktXu2UwGLPaWh4O0jrGc&#43;KMnwYkzAP0DZwAVoZZiZw=" crossorigin="anonymous"></script></head>
  <body><script src="/js/bootstrap.min.b5d86dd3a5f60c90be38a252bb65fc1a2732f32e71dc12c051720f0c7aef3cde.js" integrity="sha256-tdht06X2DJC&#43;OKJSu2X8Gicy8y5x3BLAUXIPDHrvPN4=" crossorigin="anonymous"></script><header><nav class="navbar top-app-bar top-app-bar-expand-lg fixed-top">
  <div class="container">
    <button class="navbar-settings me-1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasSettings"
  aria-controls="offcanvasSettings" aria-label="Toggle settings">
  <i class="fas fa-bars"></i>
</button>

<div class="offcanvas offcanvas-start surface" tabindex="-1" id="offcanvasSettings" aria-labelledby="offcanvasSettings">
  <div class="offcanvas-header">
    <h3 class="offcanvas-title">设置</h3>
    <button type="button" class="btn btn-sm btn-outline-primary" data-bs-dismiss="offcanvas" aria-label="Close">
      <i class="fas fa-times"></i>
    </button>
  </div>
  <div class="offcanvas-body"><section class="setting">
  <form class="row">
    <div class="col-auto">
      <label for="fontSize" class="form-label"><i class="fas fa-fw fa-language"></i> 语言</label>
    </div>
    <div class="col-auto ms-auto">
      <div class="dropdown">
        <a class="btn btn-sm btn-outline-primary dropdown-toggle" href="#" id="languageDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
          简体中文
        </a>
        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="languageDropdown"><li><a class="dropdown-item" href="/en/">English</a></li><li><a class="dropdown-item" href="/fr/">Français</a></li><li><a class="dropdown-item" href="/zh-tw/">繁體中文</a></li></ul>
      </div>
    </div>
  </form>
</section>


<section class="setting">
  <form class="row">
    <div class="col-auto">
      <label><i class="fas fa-fw fa-adjust"></i> 模式</label>
    </div>
    <div class="col-auto ms-auto">
      <div class="form-check form-switch">
        <input class="form-check-input" type="checkbox" id="modeSwitcher">
      </div>
    </div>
  </form>
</section>

<section class="setting">
  <form class="font-size-switcher-form row">
    <div class="col-auto">
      <label for="fontSize" class="form-label"><i class="fas fa-fw fa-font"></i> 字体大小</label>
    </div>
    <div class="col-auto ms-auto">
      <input type="range" class="form-range" min="-2" max="2" id="fontSize">
    </div>
  </form>
</section>


<section class="setting palettes">
  <form class="row">
    <div class="col-auto">
      <label><i class="fas fa-fw fa-palette"></i> 配色</label>
    </div>
    <div class="col-auto ms-auto">
      <a id="btnPalette" class="btn btn-sm btn-outline-primary" role="button" aria-label="palettePicker">
        <i class="fas fa-eye-dropper"></i>
      </a>
    </div>
  </form>
  <div class="mt-2 d-flex visually-hidden" id="palettePicker"><button type="button" id="palette-blue" aria-label="蓝色"
        class="btn btn-sm palette" data-palette="blue">
      </button><button type="button" id="palette-blue-gray" aria-label="蓝灰色"
        class="btn btn-sm palette" data-palette="blue-gray">
      </button><button type="button" id="palette-brown" aria-label="棕色"
        class="btn btn-sm palette" data-palette="brown">
      </button><button type="button" id="palette-cyan" aria-label="青色"
        class="btn btn-sm palette" data-palette="cyan">
      </button><button type="button" id="palette-green" aria-label="绿色"
        class="btn btn-sm palette" data-palette="green">
      </button><button type="button" id="palette-indigo" aria-label="靛青色"
        class="btn btn-sm palette" data-palette="indigo">
      </button><button type="button" id="palette-orange" aria-label="橙色"
        class="btn btn-sm palette" data-palette="orange">
      </button><button type="button" id="palette-pink" aria-label="粉色"
        class="btn btn-sm palette" data-palette="pink">
      </button><button type="button" id="palette-purple" aria-label="紫色"
        class="btn btn-sm palette" data-palette="purple">
      </button><button type="button" id="palette-red" aria-label="红色"
        class="btn btn-sm palette" data-palette="red">
      </button><button type="button" id="palette-teal" aria-label="蓝绿色"
        class="btn btn-sm palette" data-palette="teal">
      </button><button type="button" id="palette-yellow" aria-label="黄色"
        class="btn btn-sm palette" data-palette="yellow">
      </button></div>
</section>
<section class="setting social-share">
  <form class="row">
    <div class="col-auto">
      <label><i class="fas fa-fw fa-share-alt"></i> Share</label>
    </div>
    <div class="col-auto ms-auto">
      <a class="btn btn-sm btn-outline-primary btn-social-share"><i class="fas fa-share"></i></a>
    </div>
  </form>
  <div class="mt-2 social-share-buttons d-flex visually-hidden flex-nowrap">
    <a class="btn btn-sm btn-outline-primary social-share-button" rel="noopener noreferrer" aria-label="Twitter Share Button"
      target="_blank" href="https://twitter.com/intent/tweet?title=%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%8a%e6%90%ad%e5%bb%basolo%e5%8d%9a%e5%ae%a2&url=%2fzh-cn%2fposts%2f%25E9%2598%25BF%25E9%2587%258C%25E4%25BA%2591ecs%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8%25E6%2590%25AD%25E5%25BB%25BAsolo%25E5%258D%259A%25E5%25AE%25A2%25E7%25B3%25BB%25E7%25BB%259F%2f">
      <i class="fab fa-fw fa-twitter"></i> Twitter
    </a>
    <a class="btn btn-sm btn-outline-primary social-share-button" rel="noopener noreferrer" aria-label="Facebook Share Button"
      target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=%2fzh-cn%2fposts%2f%25E9%2598%25BF%25E9%2587%258C%25E4%25BA%2591ecs%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8%25E6%2590%25AD%25E5%25BB%25BAsolo%25E5%258D%259A%25E5%25AE%25A2%25E7%25B3%25BB%25E7%25BB%259F%2f">
      <i class="fab fa-fw fa-facebook-f"></i> Facebook
    </a>
  </div>
</section>

</div>
</div>
<a class="navbar-brand me-3" href="/zh-cn/"><img class="logo" alt="Logo" src="/images/logo.webp" loading="lazy"
   width="136" height="69"
   />
忆尘
    </a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <i class="fas fa-ellipsis-v"></i>
    </button>
    <div class="collapse navbar-collapse" tabindex="-1" id="navbarSupportedContent" aria-labelledby="navbarSupportedContent">
      <form class="search-bar my-1" action="/zh-cn/search">
  <div class="input-group input-group-sm">
    <span class="btn btn-search disabled position-absolute left-0"><i class="fas fa-fw fa-search"></i></span>
    <input class="form-control rounded-pill" name="q" type="search" aria-label="Search">
  </div>
</form>

      <ul class="navbar-nav ms-auto"><li class="nav-item">
          <a class="nav-link" href="/zh-cn/archives/">
            <i class="fas fa-fw fa-file-archive"></i>归档
          </a>
        </li><li class="nav-item">
          <a class="nav-link" href="/zh-cn/categories/">
            <i class="fas fa-fw fa-folder"></i>分类
          </a>
        </li><li class="nav-item">
          <a class="nav-link" href="/zh-cn/tags/">
            <i class="fas fa-fw fa-tags"></i>标签
          </a>
        </li><li class="nav-item">
          <a class="nav-link" href="/zh-cn/series/">
            <i class="fas fa-fw fa-columns"></i>专栏
          </a>
        </li><li class="nav-item dropdown">
          <a class="nav-link" id="navbarDropdown-dropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
            <i class="fas fa-fw fa-chevron-circle-down"></i>下拉菜单
          </a>
          <ul class="dropdown-menu" aria-labelledby="navbarDropdown-dropdown"><li>
              <a class="dropdown-item"
                href="https://github.com/razonyang/hugo-theme-bootstrap" target="_blank" rel="noopener noreferrer">
                <i class="fab fa-fw fa-github"></i>Github
              </a>
            </li><li>
              <a class="dropdown-item"
                href="/zh-cn/series/manual">
                用户手册
              </a>
            </li></ul>
        </li></ul>
    </div>
  </div>
</nav>
</header>
<main role="main" class="container">
      <div class="row content">
<div class="col-lg-8">
  <div class="container"><nav class="row card component" aria-label="breadcrumb">
  <div class="card-body">
    <ol class="breadcrumb "><li class="breadcrumb-item"><a href="/zh-cn/">主页</a></li><li class="breadcrumb-item"><a href="/zh-cn/posts/">文章</a></li><li class="breadcrumb-item active">云服务器上搭建solo博客</li></ol>
  </div>
</nav><article class="post row card mb-4 component">
  <div class="card-body"><div class="post-panel-wrapper">
  <div class="post-panel d-flex flex-column">
    <a id="sidebarToggler" class="action d-none d-lg-block" role="button">
  <i class="fas fa-fw fa-expand-arrows-alt"></i>
</a>
  
    

    <a class="action btn-reward" role="button" data-bs-toggle="modal" data-bs-target="#rewardModal" title="打赏">
  <i class="fas fa-fw fa-coffee"></i>
</a>
    <a class="action" data-bs-container="body" data-bs-toggle="popover" data-bs-html="true" data-bs-placement="bottom"
  data-bs-trigger="focus" tabindex="0" type="button" aria-label="Copyright" 
  data-bs-content="&lt;a target=&#34;_blank&#34; rel=&#34;license noopener noreferrer&#34; href=&#34;https://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh&#34;&gt;CC BY-NC-ND 4.0 &lt;i class=&#34;fab fa-fw fa-creative-commons&#34;&gt;&lt;/i&gt;&lt;i class=&#34;fab fa-fw fa-creative-commons-by&#34;&gt;&lt;/i&gt;&lt;i class=&#34;fab fa-fw fa-creative-commons-nc&#34;&gt;&lt;/i&gt;&lt;i class=&#34;fab fa-fw fa-creative-commons-nd&#34;&gt;&lt;/i&gt;&lt;/a&gt;
">
  <i class="fas fa-fw fa-copyright"></i>
</a>
    <a data-bs-toggle="offcanvas" href="#offcanvasTOC" aria-controls="offcanvasTOC" role="button">
  <i class="fas fa-fw fa-list-alt"></i>
</a>
  </div>
</div>
<h1 class="card-title my-3">云服务器上搭建solo博客
</h1><div class="post-meta"><span class="post-date" title="created on">
    <i class="fas fa-fw fa-calendar-alt"></i>2021-10-02
  </span><span class="post-reading-time" title="reading time">
    <i class="fas fa-fw fa-coffee"></i>2 分钟阅读
  </span><a href="/zh-cn/series/manual/" class="post-taxonomy">Manual</a><a href="/zh-cn/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" class="post-taxonomy">服务器</a><a href="/zh-cn/tags/solo/" class="post-taxonomy">solo</a><a href="/zh-cn/tags/%E5%8D%9A%E5%AE%A2/" class="post-taxonomy">博客</a></div>
<div class="offcanvas offcanvas-end surface" tabindex="-1" id="offcanvasTOC" aria-labelledby="offcanvasTOCLabel">
  <div class="offcanvas-header">
    <h2 class="offcanvas-title" id="offcanvasTOCLabel">目录</h5>
      <button type="button" class="btn btn-sm btn-outline-primary" data-bs-dismiss="offcanvas" aria-label="Close">
        <i class="fas fa-times"></i>
      </button>
  </div>
  <div class="offcanvas-body">
    <nav id="TableOfContents">
  <ul>
    <li><a href="#1-在安装docker在前先更新yum包">1. 在安装docker在前先更新yum包</a></li>
    <li><a href="#2-安装需要的软件包-yum-util-提供yum-config-manager功能另外两个是devicemapper驱动依赖的">2. 安装需要的软件包， yum-util 提供yum-config-manager功能，另外两个是devicemapper驱动依赖的</a></li>
    <li><a href="#3-设置阿里云yum源">3. 设置阿里云yum源</a></li>
    <li><a href="#4-安装docker">4. 安装docker</a></li>
    <li><a href="#5-测试docker是否安装成功">5. 测试docker是否安装成功</a>
      <ul>
        <li></li>
      </ul>
    </li>
    <li><a href="#6-安装nginx">6. 安装nginx</a></li>
    <li><a href="#7-安装-mysql">7. 安装 mysql</a></li>
    <li><a href="#8-允许外网访问mysql">8. 允许外网访问mysql</a></li>
    <li><a href="#9-登录-mysql">9. 登录 mysql</a></li>
    <li><a href="#10-设置-root-可外网访问">10. 设置 root 可外网访问</a></li>
    <li><a href="#11安装git">11.安装git</a></li>
    <li><a href="#12-拉取源码">12. 拉取源码</a></li>
    <li><a href="#13-构建镜像">13. 构建镜像</a></li>
  </ul>
</nav>
  </div>
</div><div class="post-content mb-3"><h2 id="1-在安装docker在前先更新yum包">1. 在安装docker在前先更新yum包</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">yum</span> <span class="n">update</span>
</code></pre></div><h2 id="2-安装需要的软件包-yum-util-提供yum-config-manager功能另外两个是devicemapper驱动依赖的">2. 安装需要的软件包， yum-util 提供yum-config-manager功能，另外两个是devicemapper驱动依赖的</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">sudo</span> <span class="n">yum</span> <span class="n">install</span> <span class="o">-</span><span class="n">y</span> <span class="n">yum</span><span class="o">-</span><span class="n">utils</span> <span class="n">device</span><span class="o">-</span><span class="n">mapper</span><span class="o">-</span><span class="n">persistent</span><span class="o">-</span><span class="n">data</span> <span class="n">lvm2</span>
</code></pre></div><h2 id="3-设置阿里云yum源">3. 设置阿里云yum源</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">sudo</span> <span class="n">yum</span><span class="o">-</span><span class="n">config</span><span class="o">-</span><span class="n">manager</span> <span class="o">--</span><span class="n">add</span><span class="o">-</span><span class="n">repo</span> <span class="n">http</span><span class="o">:</span><span class="c1">//mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
</span></code></pre></div><h2 id="4-安装docker">4. 安装docker</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">yum</span> <span class="n">install</span> <span class="n">docker</span><span class="o">-</span><span class="n">ce</span> <span class="n">docker</span><span class="o">-</span><span class="n">ce</span><span class="o">-</span><span class="n">cli</span> <span class="n">containerd</span><span class="o">.</span><span class="na">io</span>
</code></pre></div><h2 id="5-测试docker是否安装成功">5. 测试docker是否安装成功</h2>
<ul>
<li>启动docker</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">systemctl</span> <span class="n">start</span> <span class="n">docker</span>
</code></pre></div><ul>
<li>运行docker hello world</li>
</ul>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">docker</span> <span class="n">run</span> <span class="n">hello</span><span class="o">-</span><span class="n">world</span>
</code></pre></div><h4 id="出现hello-from-docker如下图所示则安装成功">出现Hello from Docker！！如下图所示：则安装成功</h4>
<p><img class="img-fluid" alt="image-20210921170731458" src="" loading="lazy"
  
   />

</p>
<h2 id="6-安装nginx">6. 安装nginx</h2>
<p>这里的 nginx 我采用的是 docker 安装，因为需要 nginx 配置域名的 https，因此，我们需要把 nginx 的配置文件挂载在主机目录</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">docker</span> <span class="n">run</span> <span class="o">-</span><span class="n">d</span> <span class="o">--</span><span class="n">name</span> <span class="n">nginx</span> <span class="o">-</span><span class="n">p</span> <span class="n">80</span><span class="o">:</span><span class="n">80</span> <span class="o">-</span><span class="n">p</span> <span class="n">443</span><span class="o">:</span><span class="n">443</span> <span class="err">\</span>
<span class="ln">2</span><span class="o">-</span><span class="n">v</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">nginx</span><span class="o">.</span><span class="na">conf</span><span class="o">:/</span><span class="n">etc</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">nginx</span><span class="o">.</span><span class="na">conf</span> <span class="err">\</span>
<span class="ln">3</span><span class="o">-</span><span class="n">v</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">logs</span><span class="o">:/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">nginx</span> <span class="err">\</span>
<span class="ln">4</span><span class="o">-</span><span class="n">v</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">html</span><span class="o">:/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">html</span> <span class="err">\</span>
<span class="ln">5</span><span class="o">-</span><span class="n">v</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">conf</span><span class="o">:/</span><span class="n">etc</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">conf</span><span class="o">.</span><span class="na">d</span> <span class="err">\</span>
<span class="ln">6</span><span class="o">-</span><span class="n">v</span> <span class="o">/</span><span class="n">opt</span><span class="o">/</span><span class="n">nginx</span><span class="o">/</span><span class="n">ssl</span><span class="o">:/</span><span class="n">root</span><span class="o">/</span><span class="n">ssl</span> <span class="err">\</span>
<span class="ln">7</span><span class="o">--</span><span class="n">privileged</span><span class="o">=</span><span class="kc">true</span> <span class="err">\</span>
<span class="ln">8</span><span class="n">nginx</span>
</code></pre></div><p>各个参数的意义：
-d：后台运行 nginx 容器
&ndash;name nginx：指定 nginx 的容器名为 nginx
-p 80:80：将容器的 80 端口映射到主机 80 端口，ps：前面的端口为主机端口
-p 443:443：将容器的 443 端口映射到主机 443 端口， ps：443端口为 https 端口，后续配置 https 我们将使用到这个端口
-v /opt/nginx/nginx.conf:/etc/nginx/nginx.conf：将 nginx 的配置文件映射到主机，ps：前面为主机目录，后面为 nginx 的容器目录
-v /opt/nginx/logs:/var/log/nginx：将 nginx 的日志文件映射到主机
-v /opt/nginx/html:/usr/share/nginx/html：将 nginx 的 html 静态文件映射到主机
-v /opt/nginx/conf:/etc/nginx/conf.d：将 nginx 的配置文件夹映射到主机
-v /opt/nginx/ssl:/root/ssl：将 主机的 ssl https 密匙，映射到 nginx 的 /root/ssl 目录
&ndash;privileged=true ：容器用户运行 root 权限</p>
<h2 id="7-安装-mysql">7. 安装 mysql</h2>
<p>为了简单方便，我这里安装 mysql 的方式是采用 dokcer 安装</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">docker</span> <span class="n">run</span> <span class="o">--</span><span class="n">name</span> <span class="n">mysql</span> <span class="o">-</span><span class="n">p</span> <span class="n">3306</span><span class="o">:</span><span class="n">3306</span> <span class="o">-</span><span class="n">e</span> <span class="n">MYSQL_ROOT_PASSWORD</span><span class="o">=</span><span class="n">数据库密码</span> <span class="o">-</span><span class="n">d</span> <span class="n">mysql</span><span class="o">:</span><span class="n">8</span><span class="o">.</span><span class="na">0</span>
</code></pre></div><h2 id="8-允许外网访问mysql">8. 允许外网访问mysql</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">docker</span> <span class="n">exec</span> <span class="o">-</span><span class="n">it</span> <span class="n">mysql</span> <span class="n">bash</span>
</code></pre></div><h2 id="9-登录-mysql">9. 登录 mysql</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">mysql</span> <span class="o">-</span><span class="n">uroot</span> <span class="o">-</span><span class="n">p数据库密码</span>
</code></pre></div><h2 id="10-设置-root-可外网访问">10. 设置 root 可外网访问</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">GRANT</span> <span class="n">ALL</span> <span class="n">ON</span> <span class="o">*.*</span> <span class="n">TO</span> <span class="err">&#39;</span><span class="n">root</span><span class="sc">&#39;@&#39;</span><span class="o">%</span><span class="err">&#39;</span><span class="o">;</span> 
<span class="ln">2</span><span class="n">flush</span> <span class="n">privileges</span><span class="o">;</span>
</code></pre></div><p>完成之后，输入两次exit退出</p>
<h2 id="11安装git">11.安装git</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">yum</span> <span class="n">install</span> <span class="n">git</span>
</code></pre></div><h2 id="12-拉取源码">12. 拉取源码</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="o">:</span><span class="c1">//github.com.cnpmjs.org/adlered/bolo-solo.git
</span></code></pre></div><h2 id="13-构建镜像">13. 构建镜像</h2>
<p>我们是需要 https 访问的，所以需要做如下的操作：</p>
<p>前往项目根目录下src/main/resources目录，编辑latkes.properties文件，将http修改为https，即可使用 https 访问。</p>
<p>进入项目根目录，执行一下的命令</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-java" data-lang="java"><span class="ln">1</span><span class="n">docker</span> <span class="n">build</span> <span class="o">-</span><span class="n">t</span> <span class="s">&#34;bolo&#34;</span> <span class="o">.</span>
</code></pre></div><p>注意最后面有个点</p>
</div><div class="modal fade" id="rewardModal" tabindex="-1" aria-labelledby="rewardModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content surface">
      <div class="modal-header">
        <h5 class="modal-title" id="rewardModalLabel"><i class="fas fa-fw fa-coffee"></i>打赏</h5>
        <a href="#" data-bs-dismiss="modal" class="btn btn-sm btn-outline-primary" aria-label="Close"><i class="fas fa-times"></i></a>
      </div>
      <div class="modal-body">
        <ul class="nav nav-tabs flex-nowrap mb-3" role="tablist"><li class="nav-item text-nowrap" role="presentation">
            <a class="nav-link active" id="reward-alipay-tab" data-bs-toggle="tab" href="#reward-alipay" role="tab" aria-controls="reward-alipay" aria-selected="true">
              <i class="fab fa-fw fa-alipay"></i>支付宝
            </a>
          </li><li class="nav-item text-nowrap" role="presentation">
            <a class="nav-link" id="reward-wechat-tab" data-bs-toggle="tab" href="#reward-wechat" role="tab" aria-controls="reward-wechat" aria-selected="true">
              <i class="fab fa-fw fa-weixin"></i>微信
            </a>
          </li></ul>
        <div class="tab-content" id="rewardTabContent"><div class="tab-pane fade post-reward-content show active" id="reward-alipay" role="tabpanel" aria-labelledby="reward-alipay-tab">
            <img class="img-fluid post-reward-img" src="/images/reward/alipay.png" loading="lazy" />
          </div><div class="tab-pane fade post-reward-content show" id="reward-wechat" role="tabpanel" aria-labelledby="reward-wechat-tab">
            <img class="img-fluid post-reward-img" src="/images/reward/wechat.png" loading="lazy" />
          </div></div>
      </div>
    </div>
  </div>
</div><hr /><div class="post-navs d-flex mb-3 justify-content-evenly">
  <div class="post-nav post-prev"><i class="fas fa-fw fa-chevron-left"></i>
    <a href="/zh-cn/posts/markdown-syntax/">Markdown Syntax Guide
</a>
  </div></div><section class="related-posts-wrapper">
    <h3>相关文章</h3>
    <ul class="related-posts"><li><a href="/zh-cn/posts/markdown-syntax/">Markdown Syntax Guide
</a></li></ul>
  </section></div>
</article><div class="post-comments card row component">
  <div class="card-body"><script src="https://utteranc.es/client.js"
  repo="razonyang/hugo-theme-bootstrap-comments"
  issue-term="pathname"
  label="comment"
  theme="github-light"
  crossorigin="anonymous"
  async>
</script></div>
</div></div>
</div><aside class="col-lg-4 sidebar d-flex">
  <div class="container">
    
    <section class="card row text-center profile component">
  <div class="card-body">
    <div class="col-12 d-flex align-items-center justify-content-center"><img class="profile-avatar rounded-circle" alt="Yi Chen" src="/images/profile.webp" loading="lazy"
   width="400" height="400"
   />
</div>
    <div class="col-12 profile-meta"><div class="profile-name">Yi Chen</div><div class="profile-bio">好记性不如烂笔头.</div><div class="profile-company"><i class="fas fa-fw fa-building"></i>无</div><div class="profile-location"><i class="fas fa-fw fa-map-marker-alt"></i>福州</div></div>
  </div>
</section>
  <section class="featured-posts row card component">
    <div class="card-body">
      <h2 class="card-title">精选文章</h2>
      <ul><li><a href="/zh-cn/posts/%E9%98%BF%E9%87%8C%E4%BA%91ecs%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BAsolo%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F/">云服务器上搭建solo博客
</a></li><li><a href="/zh-cn/posts/markdown-syntax/">Markdown Syntax Guide
</a></li></ul>
    </div>
  </section><section class="recent-posts row card component">
  <div class="card-body">
    <h2 class="card-title">最近文章</h2>
    <ul><li><a href="/zh-cn/posts/%E9%98%BF%E9%87%8C%E4%BA%91ecs%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%90%AD%E5%BB%BAsolo%E5%8D%9A%E5%AE%A2%E7%B3%BB%E7%BB%9F/">云服务器上搭建solo博客
</a></li><li><a href="/zh-cn/posts/markdown-syntax/">Markdown Syntax Guide
</a></li></ul>
  </div>
</section><section class="taxonomies row card component">
      <div class="card-body">
        <h2 class="card-title">
          <a href="/zh-cn/series">专栏</a>
        </h2>
        <div><a href="/zh-cn/series/manual/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="Manual">
            Manual
          </a></div>
      </div>
    </section><section class="taxonomies row card component">
      <div class="card-body">
        <h2 class="card-title">
          <a href="/zh-cn/tags">标签</a>
        </h2>
        <div><a href="/zh-cn/tags/css/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="CSS">
            CSS
          </a><a href="/zh-cn/tags/html/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="HTML">
            HTML
          </a><a href="/zh-cn/tags/markdown/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="Markdown">
            Markdown
          </a><a href="/zh-cn/tags/solo/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="solo">
            solo
          </a><a href="/zh-cn/tags/%E5%8D%9A%E5%AE%A2/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="博客">
            博客
          </a><a href="/zh-cn/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" class="post-taxonomy rounded btn btn-sm btn-outline-primary me-2 mb-2" title="服务器">
            服务器
          </a></div>
      </div>
    </section>
    
  </div>
</aside>
</div>
    </main><footer class="footer mt-auto py-3 text-center container"><nav class="social-links nav my-2 justify-content-center"><a class="nav-link social-link" target="_blank" href="https://space.bilibili.com/yourbilibiliuserid" title="bilibili" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fas fa-tv"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://bitbucket.org/yourbitbucketworkspaceid" title="Bitbucket" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-bitbucket"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://discord.com/invite/yourdiscordinvitecode" title="Discord" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-discord"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://yourforum.tld" title="Discourse" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-discourse"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://hub.docker.com/u/yourdockerhubusername" title="Docker Hub" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-docker"></i>
      </a><a class="nav-link social-link" href="mailto:user@domain.tld" title="Email">
      <i class="fas fa-fw fa-2x fa-envelope"></i>
    </a><a class="nav-link social-link" target="_blank" href="https://facebook.com/yourfacebookusername" title="Facebook" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-facebook-f"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://facebook.com/groups/yourfacebookgroupname" title="Facebook Group" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-facebook-square"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://github.com/yourgithubusername" title="GitHub" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-github"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://gitlab.com/yourgitlabusername" title="GitLab" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-gitlab"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.instagram.com/yourinstagramusername" title="Instagram" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-instagram"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://kaggle.com/yourkaggleusername" title="Kaggle" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-kaggle"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.last.fm/user/yourlastfmusername" title="Last.fm" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-lastfm"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://linkedin.com/yourlinkedinusername" title="LinkedIn" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-linkedin-in"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://medium.com/@yourmediumusername" title="Medium" rel="noopener noreferrer">
        <i class="fab fa-fw fa-2x fa-medium-m"></i>
      </a><a class="nav-link social-link" target="_blank" href="http://wpa.qq.com/msgrd?v=3&amp;uin=yourqqnumber&amp;site=qq&amp;menu=yes" title="QQ" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-qq"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.quora.com/profile/yourquorausername" title="Quora" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-quora"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.reddit.com/user/yourredditusername" title="Reddit" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-reddit"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://stackoverflow.com/users/yourstackoverflowuserid" title="Stack Overflow" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-stack-overflow"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://t.me/yourtelegramusername" title="Telegram" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-telegram-plane"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.tiktok.com/@yourtiktokusername" title="TikTok" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-tiktok"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://yourtumblrusername.tumblr.com" title="Tumblr" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-tumblr"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://twitter.com/yourtwitterusername" title="Twitter" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-twitter"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://weibo.com/yourweibousername" title="Weibo" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-weibo"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.youtube.com/channel/youryoutubechannelid" title="Youtube" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-youtube"></i>
      </a><a class="nav-link social-link" target="_blank" href="https://www.zhihu.com/people/yourzhihuusername" title="Zhihu" rel="noopener noreferrer">
        <i class="fa-fw fa-2x fab fa-zhihu"></i>
      </a></nav>
<div class="copyright mb-2">
  忆尘博客 © 2021-2021 Yi Chen. 版权所有.
</div>
</footer>

</body>
</html>
